<template>
  <div class="hello">
    <h2>{{count}}</h2>
    <button @click="addCount">add</button>
    <button @click="subCount">sub</button>
  </div>
</template>

<script>
import { isRef } from '@vue/reactivity'
  // 自定义ref 
  import debounceRef from '../util/debounce.js'

  export default {
    name: 'HelloWorld',
    setup() {
      const num = 0
     let count = debounceRef(num)
     console.log(isRef(count)) //true
     const addCount = () => {
       count.value++
       console.log(count.value)
     }
     const subCount = () => {
       count.value--
     }
     return {
       count,
       addCount,
       subCount
     }
    }
  }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
  margin: 40px 0 0;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
</style>
